﻿using ChronoScript_Compiler.Language;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Viper.Opcodes;

namespace ChronoScript_Compiler.CodeGen
{
    public partial class CodeGen
    {
        public void Call(LanguageDefinition.FunctionCall fc)
        {
            foreach (LanguageDefinition.Expression exp in fc.Arguments)
            {
                if (GuessType(exp) == VType.Dword)
                    ParseArthemeticExpression(exp);
                else if (GuessType(exp) == VType.String)
                {
                    ParseStringExpression(exp);
                }
            }
            Console.WriteLine(GetMethodName(fc));
            Assembler.Emit(new bsr(GetMethodName(fc)));
        }
    }
}
